package com.tocea.formation.model;

import java.util.Set;

import javax.persistence.Entity;


@Entity
public class Calendar {
	private Integer id;
	private Person owner;
	private Set<Person> guests;
	
	public Calendar(){}
	
	public Calendar(Integer _id, Person _owner, Set<Person> _guests){
		this.id = _id;
		this.owner = _owner;
		this.guests = _guests;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Person getOwner() {
		return owner;
	}

	public void setOwner(Person owner) {
		this.owner = owner;
	}

	public Set<Person> getGuests() {
		return guests;
	}

	public void setGuests(Set<Person> guests) {
		this.guests = guests;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((guests == null) ? 0 : guests.hashCode());
		result = prime * result + ((owner == null) ? 0 : owner.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Calendar other = (Calendar) obj;
		if (guests == null) {
			if (other.guests != null)
				return false;
		} else if (!guests.equals(other.guests))
			return false;
		if (owner == null) {
			if (other.owner != null)
				return false;
		} else if (!owner.equals(other.owner))
			return false;
		return true;
	}
	
	
}
